<template>
	<view v-if="is_init">


		<uni-popup-input name="插件创建成功" @close="on_close">

			 
			<view class="" style="color: #808080;padding-top: 40rpx;">
				使用方法：去未安装的插件里找到插件并安装插件,安装成功后，下载uniapp用户端和管理端;文件在
				<text class="cred">根目录/plugin/{{catalogue}}/uniapp/ 目录admin=管理端；home=用户端</text>
				下载后直接导入到hb编辑器运行就可以使用,接口已配置完成，无需配置
			</view>

			<view class="a-c  p-b-20 banmi_input_edit" style="padding-top: 40rpx;">
				<view class="banmi_input_edit_name">
				</view>
				<view class="">
					<button @click="on_close()" type="primary" style="width: 80px;" size="mini">关闭</button>
				</view>
			</view>




		</uni-popup-input>
	</view>
</template>

<script>
	import {
		buildMenus,
		getParents,
		patTree,
		getSortMenu
	} from '@/components/uni-data-menu/util.js'

	export default {
		components: {
			 
		},
		props: {

		},
		data() {
			return {

				up_find: {},
				uid: 0,
				is_init: false,
				nav_list: [],
				img_url: '',
				menu_list: [],
				nav_id: 0,
				list_nav: [],
				zip_url: '',
				status: 0,
				catalogue:""

			}
		},

		methods: {
			on_updata() {
				window.open(this.zip_url, '_blank');
			},
			async on_plugin_testing() {
				if (!this.find.catalogue) {
					uni.showToast({
						title: '请输入插件别名目录',
						icon: 'none'
					})
					return
				}
				uni.showLoading({
					title: '正在检测中...',
					mask: true
				})
				const ret = await this.Banmikeji.pluginlist_plugin_testing(this.find);

				uni.hideLoading()
				uni.showModal({
					title: '提示',
					content: ret.msg,
					confirmText: '知道了',
					showCancel: false,
					success: function(res) {

					}
				});

			},
			async on_add() {
				if (!this.find.plugin_name) {
					uni.showToast({
						title: '请输入插件名称',
						icon: 'none'
					})
					return
				}
				if (!this.find.catalogue) {
					uni.showToast({
						title: '请输入插件别名目录',
						icon: 'none'
					})
					return
				}



				uni.showLoading({
					title: '正在创建中,请耐心等待，不要关闭窗口',
					mask: true
				})
				const ret = await this.Banmikeji.pluginlist_add_plugin(this.find);
				this.status = ret.status;


				uni.showToast({
					title: ret.msg,
					icon: 'none'
				})





			},
			init(catalogue) {
				var that = this;
				this.catalogue=catalogue;
				 
				this.is_init = true;
				 
			},
			on_close() {
				this.find = {
					plugin_name: '',
					catalogue: ''

				}
				this.zip_url = '';
				this.is_init = false;
			},
			//js分类方法

		}
	}
</script>

<style>
	/* 	button::after {
		border: none;
	} */

	.top_head {
		background-color: #F8F8F8;
		width: 100%;
		top: 0;
		left: 0;
		z-index: 999;
		position: sticky
	}

	.but {
		width: 120rpx;
		height: 100rpx;
		padding: 0;
		border: 0;
		background-color: transparent;
		outline: none;
	}

	button {
		padding: 0;

		/* 	background: transparent; */
	}

	.top_but {
		background-color: #F8F8F8;
		width: 100%;
		height: 100rpx;
		top: 0;
		left: 0;
		z-index: 999;
		position: sticky
	}

	.zu_but {
		position: fixed;
		height: 100rpx;
		z-index: 999;
		background-color: #F8F8F8;
		bottom: 288rpx;
	}

	.option_box {
		width: 35rpx;
		height: 35rpx;
		border: 1rpx solid #999999;
		border-radius: 5px;
		margin-right: 10rpx;
		// background-color: #FF852A;
		display: flex;
		justify-content: center;
		align-items: center;

		image {
			width: 20rpx;
			height: 20rpx;
		}
	}

	.option_box_active {
		background: linear-gradient(-30deg, #ff7029 0%, #faa307 100%);
		border: 1rpx solid #faa307 !important;
	}

	.sub_btn_add {
		margin-left: 30rpx;
		width: 150rpx;
		height: 60rpx;
		background: linear-gradient(-30deg, #A9A9A9 0%, #A9A9A9 100%);
		border-radius: 44rpx;

		font-size: 30rpx;
		font-weight: 700;
		color: #ffffff;

		line-height: 60rpx;
	}

	.sub_btn {

		height: 70rpx;
		width: 100rpx;
		background: #0071FE;
		border-radius: 10rpx;
		font-size: 30rpx;
		color: #ffffff;
		line-height: 70rpx;
	}
</style>